﻿using System;
using System.Collections.Generic;
//using System.Linq;
using System.Text;
//using System.Threading.Tasks;
using System.Net;
using Urd.Packet;

namespace Urd.Common
{
    //добавить автокалькуляцию кеша для сборок наследуемых от этого класса.
    public abstract class worker
    {
        protected Opcode opcode_to_accept;
        public Opcode opcode { get { return opcode_to_accept; } set {if(opcode_to_accept==Opcode.Undefined) opcode_to_accept = value; } }

        protected string name;
        public string Name { get { return name; } set { if(name=="none")name = value; } }
        public delegate packet Process(cache c, packet p = null);
        protected packet cachedpacket;
        public packet GetCachedPacket { get { return cachedpacket; } }
        //public managerinfo Info { get { return info; } set { info = value; } }
        //public readonly Opcode O;
        public abstract packet process(cache c, packet p = null);
       
        public worker() 
        {
            opcode_to_accept = Opcode.Undefined;
            name = "none";
            cachedpacket = new packet(Opcode.Undefined, Command.None);
        }
    }
}
